<template>
    <div>
        <h2>老师注册页面</h2>
        <p>老师姓名：<input type="text" v-model="name"></p>
        <p>老师密码：<input type="text" v-model="password"></p>
        <button @click="register()">注册</button>    
    </div>    
</template>

<script>
import axios from "axios"
export default {
    name:"register",
    data() {
        return {
            name:"",
            password:""
        }
    },
    methods: {
        register(){
            let formdata = new FormData()
            formdata.append("name",this.name)
            formdata.append("password",this.password)
            axios({
                url:"http://127.0.0.1:8000/app03/teacher/",
                method:"post",
                data:formdata
            }).then(res=>{
                console.log(res.data)
                this.$router.push({name:"login"})
            })
        }
    },
}
</script>

<style>

</style>
